public class MethodOne {

    public static void main(String[] args) throws InterruptedException {
        Student student = new Student();
        Thread thread = new Thread(new MyRunnable(student));
        thread.start();
        // 获取子线程的返回值：让主线程等待1s，
        // 如果把下面的while代码注掉，主线程将获取不到student.getName()返回值
        while (student.getName() == null){
            Thread.sleep(1000);
        }
        System.out.println(student.getName());
    }
}
